Add string operator $replaceAll/$replaceOne tests#79
Add string operator $replaceAll/$replaceOne tests#79nitinahuja89 merged 5 commits intodocumentdb:mainfrom
Conversation
622c724 to
0c969fb
Compare
danielfrankcom
left a comment
There was a problem hiding this comment.
Seems like we might need to add some kind of pytest mark to indicate these tests are expected to fail for MongoDB as previously discussed? If we override the merge conditions here we'll end up with all future PRs failing these checks which seems undesirable.
danielfrankcom
left a comment
There was a problem hiding this comment.
Won't the use of xfail mean that the compatibility tests expect all compatible databases to fail this test?
Since in this case it may be a database-specific issue, we may need a different approach here or we may cause this to fail for other compatible implementations even though the same problem doesn't exist.
I'm not sure whether this would work for us in practice, but it looks like the |
|
Seems like the Haven't tested this, but we might need to do something like this: def pytest_configure(config):
# We might be able to do this in the static `.ini` file instead, not sure.
config.addinivalue_line(
"markers",
"engine_xfail(engine, reason): expected failure for a specific engine",
)
def pytest_runtest_setup(item):
for marker in item.iter_markers("engine_xfail"):
if item.config.engine_name == marker.kwargs.get("engine"):
pytest.xfail(marker.kwargs.get("reason", ""))And then in the test file: marks=(pytest.mark.engine_xfail(engine="mongodb", reason="MongoDB returns invalid UTF-8 for empty-find multibyte"),), |
aace4c9 to
5ceddd6
Compare
df85c3d to
6fff15a
Compare
danielfrankcom
left a comment
There was a problem hiding this comment.
Most comments are around the introduction of xfail, which I guess is the downside of folding this change into an existing PR with test additions.
6fff15a to
eaf0342
Compare
1ed612f to
eaf0342
Compare
90093a1 to
a042cd8
Compare
a042cd8 to
946780e
Compare
Signed-off-by: Daniel Frankcom <frankcom@amazon.com>
- Add __init__.py for package resolution - Add ExpressionTestCase to utils/ - Add REPLACE_* error codes, FAILED_TO_PARSE_ERROR, INVALID_DOLLAR_FIELD_PATH, STRING_SIZE_LIMIT_ERROR to error_codes.py - Add STRING_SIZE_LIMIT_BYTES to test_constants.py - Fix pytest_params import (parametrize module) - Use relative imports for operator common utils - Pin CI MongoDB to 8.2.4 - Run isort/black formatting Signed-off-by: Yunxuan Shi <yunxuan@amazon.com>
- Add _truncate_repr() to cap custom error messages at 1000 chars - Use raise AssertionError for large values to suppress pytest introspection - Keep bare assert for normal-sized values to preserve pytest diff - Add truncation_limit_lines/chars to pytest.ini as safety net Signed-off-by: Yunxuan Shi <yunxuan@amazon.com> # Conflicts: # documentdb_tests/framework/assertions.py
- Fix replaceOne/replaceAll tests to use assert_expression_result - Add unit marker to pytest.ini Signed-off-by: Yunxuan Shi <yunxuan@amazon.com>
Signed-off-by: Yunxuan Shi <yunxuan@amazon.com>
58bea3f to
32e67f5
Compare
Add compatibility tests for the $replaceAll and $replaceOne operators.
Ref: #10
Tests cover:
497 tests total (3 known failures: empty_find_multibyte tests fail due to pymongo UTF-8 decoding of invalid byte sequences).